﻿<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	request.setAttribute("path", path);
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
  <meta name="viewport" content="width=drvice-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
 
    <link rel="stylesheet" type="text/css" href="${path}/css/style.css">
	<link rel="stylesheet" type="text/css" href="${path}/css/common.css">
    <script src="${path}/js/jquery.1.11.1.js"></script>

	<!-- 返回顶部2个JS -->
	
<script language="javascript" src="${path}/js/jquery-2.1.1.js"></script>
	<script type="text/javascript" src="${path}/js/ajaxfileupload.js"></script>
 <script type="text/javascript" src="${path}/layer_mobile/layer.js"></script>
<script type="text/javascript" src="${path}/js/bootstrap-fileinput.js"></script>
<link href="${path}/css/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" />
<link href="${path}/css/bootstrap-fileinput.css" media="all" rel="stylesheet" type="text/css" />
        <title>五天情侣-来一场爱情时间赛</title>
	


</head>
<body>
<div class="a of">
	
	<div class="k">
		
	</div>
	<!-- 视频 -->
	<div class="q">
			<img src="${path}/images/logo.png" width="100%"  height="100%"/>
	</div>
	<!-- 在线人数 评论条数 -->
	
</div>
  <div class="i">
	
		<form id="form" action="${path}/qianshijianlist/save" method="post" class="white-pink" >
		
			<label >
		</label>
		<br>
			<label>
			<span >标题：</span>
			<input id="title" type="text" name="title"   placeholder="请填写标题"  value="${data.title}"  style="font-size:13px" />
			</label>
			<label>
			<span >时间：</span>
			<input id="wtime" type="text" name="wtime" placeholder="请填写时间" 
								style="font-size:13px"  value="${data.wtime}"   />
			</label>
			
			
		
			<!--	<label>
			<span style="font-size: 12px;color:#666;">报名方式（*）：</span>
                     <select id="isyx" name="isyx"  style="font-size:13px">
                            <option value="">请选择</option>
                             <option value="0" >分享链接</option>
                             <option value="1" ></option>
                           
                        </select>
			</label>  -->
			
			<label>
			<span >简介：</span>
			<textarea id="Introduce" name="Introduce" placeholder="简介" style="font-size:12px" >${data.introduce}</textarea>
			</label>
			
			<label>
			<span>上传图片：</span>

				</label>
					<div class="form-group">
						<div class="col-md-8">
						
							<div class="fileinput fileinput-new" data-provides="fileinput">
								<div class="fileinput-new thumbnail"
									style="width: 220px; height:220px;">
									<img src="${data.imgurl}" >
								</div>
								<div class="fileinput-preview fileinput-exists thumbnail"
									style="max-width: 220px; max-height: 220px;"></div>
								<div>
									<span style="font-size:12px"  class="btn default btn-file">
									 <span class="fileinput-new"> 选择图片 </span> 
										<span class="fileinput-exists"> 修改图片 </span> 
										<input type="file" id="file1" name="file1" />
									</span> 

								</div>								
							</div>
										
												
						</div>					
					</div>
					
				
								
			<label>
			<span>&nbsp;</span>
			   <input type="hidden" id="imgurl" name="imgurl" class="form-control"
                                                       value="${data.imgurl}"/>
			    <input type="hidden" name="wid"  value="${wid}" />
			     <input type="hidden" name="id"  id="cid" value="${data.id}" />
         <input type="button" id="bygy" onclick="save();"
											style="width:100%;height:44px;background:#ffe323;border:none;font-size:15px;color:#3a3a3a;border-radius:0;box-shadow: 0px 0px 0px #888888"
											value="提交 ">
                                                                                                                                                                                                                                                       
			</label>
		</form>
	</div>
   <script type="text/javascript">
		function save() {
			//获取类型
 	
	
	    		if ($("#title").val() == "") {
					layer.open({
					    content: '标题不能为空'
					    ,skin: 'msg'
					    ,time: 2 //2秒后自动关闭
					  });
				}
					
	    	
	    			if($("#file1").val() !== ""){
		    			//判断是否为图片
		    			if(checkTypes('file1')){
		    				$.ajaxFileUpload({
		    					url : '${path}/conf/upload',
		    					async : false,
		    					secureuri : false,
		    					fileElementId : 'file1',
		    					dataType : 'json',
		    					success : function(data, status) {
		    						if (data.statusCode == 200) {
		    							$("#imgurl").val(data.uri);
		    							
		    			    			$("#form").submit();
		    						} else
		    							alert(data.info);
		    						   
		    					}
		    				});	
		    			}else {alert("请上传jpg、jpeg、png、bmp、gif格式的图片");}
		    		}else{
		    			$("#form").submit();	
		    		}
	    		
	    		
	    		 
			//	$("#form").submit();	
		 
	    	
		}
		//检测图片是否符合规范
		function checkTypes(id){
			var File_box = document.getElementById(id);
			var extend = File_box.value.substring(File_box.value.lastIndexOf(".") + 1);
			if(extend == "jpg" || extend=="png" || extend=="jpeg" || extend== "bmp" || extend == "gif"){
				return true;
			}
		}
 
	</script>
   
</body>
</html>

